package no.kolstad.movies.webapp.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import no.kolstad.movies.service.GenericManager;
import no.kolstad.movies.model.Movie;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class MovieController implements Controller {
    private GenericManager<Movie, Long> movieManager;

    public void setMovieManager(GenericManager<Movie, Long> movieManager) {
        this.movieManager = movieManager;
    }

    public ModelAndView handleRequest(HttpServletRequest request,
                                      HttpServletResponse response)
    throws Exception {
        return new ModelAndView().addObject(movieManager.getAll());
    }
}
